<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
    <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#bill-list')}">
        <fieldset>
            <legend style="font-weight:normal;">页头搜索：</legend>
            <div style="margin:0; padding:1px 5px 5px;">
                <span>起始时间</span>
                <input type="text" value="" name="start_time" data-toggle="datepicker" placeholder="点击选择日期"
                       data-rule="date">
                <span>结束时间</span>
                <input type="text" value="" name="end_time" data-toggle="datepicker" placeholder="点击选择日期"
                       data-rule="date">
                <span>业主</span>
                <input type="text" name="owner" class="form-control" size="15">
                <span>类型</span>
                <select data-toggle="selectpicker" name="type">
                    <option value="" selected="">全部</option>
                    <option value="1">电费</option>
                    <option value="2">水费</option>
                </select>
                <span>状态</span>
                <select data-toggle="selectpicker" name="status">
                    <option value="" selected="">全部</option>
                    <option value="0">待缴费</option>
                    <option value="1">已缴费</option>
                    <option value="2">逾期</option>
                </select>
                <div class="btn-group">
                    <button type="submit" class="btn-green" data-icon="search">开始搜索！</button>
                    <button type="reset" class="btn-orange" data-icon="times">重置</button>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<div class="bjui-pageContent">
    <table class="table table-bordered" id="bill-list" data-toggle="datagrid" data-options="{
    height: '100%',
    gridTitle : '账单列表',
    showToolbar: true,
    fullGrid:true,
    fieldSortable:false,
    filterThead:false,
    filterMult:false,
    columnMenu:false,
    local: 'remote',
    dataUrl:'admin/administration/cost-management/bill-list',
    editUrl:'admin/administration/cost-management/bill-edit',
    toolbarCustom: toolbar,
    linenumberAll: true
}">
        <thead>
        <tr>
            <th data-options="{name:'owner',align:'center',width:70}">业主</th>
            <th data-options="{name:'unit_price',align:'center',width:70}">单价</th>
            <th data-options="{name:'prior_number',align:'center',width:70}">上期数量</th>
            <th data-options="{name:'current_number',align:'center',width:70}">本期数量</th>
            <th data-options="{name:'abatement_unit_price',align:'center',width:70}">减免单价</th>
            <th data-options="{name:'abatement_number',align:'center',width:70}">减免数量</th>
            <th data-options="{name:'money',align:'center',width:70}">应收金额</th>
            <th data-options="{name:'amount_received',align:'center',width:70}">已收金额</th>
            <th data-options="{name:'start_time',align:'center',width:70,type:'date',pattern:'yyyy-MM-dd'}">开始时间</th>
            <th data-options="{name:'end_time',align:'center',width:70,type:'date',pattern:'yyyy-MM-dd'}">结束时间</th>

            <th data-options="{name:'payment_time',align:'center',width:70,type:'date',pattern:'yyyy-MM-dd',render:function(value,data){if(value==0) return '未缴费'}}">
                最后缴费时间
            </th>
            <th data-options="{name:'type',align:'center',width:70,type:'select',items:[{'1':'电费'}, {'2':'水费'}]}">
                类型
            </th>
            <th data-options="{name:'status',align:'center',width:70,type:'select',items:[{'0':'待缴费'},{'1':'已缴费'}, {'2':'逾期'},{'3':'逾期已缴费'}]}">
                状态
            </th>
            <th data-options="{align:'center',render:operationColumn}">操作</th>
        </tr>
        </thead>
    </table>
</div>
<script>
    function operationColumn(value, data) {
        var html = '<button type="button" class="btn btn-green" data-toggle="dialog" data-options="{id:\'bill-edit\', url:\'/admin/administration/cost-management/bill-edit\', mask:true, width:900, height:400, title:\'编辑账单\',data:{id:' + data.id + '}}"><i class="fa fa-edit"></i>编辑</button>';
//        html += '<button type="button" class="btn btn-red bjui-datagrid-btn delete"  data-toggle="del.datagrid.tr" ><i class="fa fa-remove"></i>删除</button>';
        return html;
    }

    function toolbar() {
        var html = '<button type="button" class="btn btn-blue"  data-toggle="dialog" data-options="{id:\'bill-add\', url:\'/admin/administration/cost-management/bill-add\', title:\'添加账单\',width:900,height:400,data:{addFlag:1}, mask:true}"><i class="fa fa-plus"></i> 添加</button>';
        html += '<button type="button" class="btn btn-blue"  data-toggle="dialog" data-options="{id:\'bill-import\', url:\'/admin/administration/cost-management/bill-import\', title:\'导入账单\',width:500,height:400,data:{addFlag:1}, mask:true}"><i class="fa fa-plus"></i> 导入</button>';
//        html+='<button type="button" class="btn btn-blue"  data-toggle="dialog" data-options="{id:\'electricity-bill-export\', url:\'/urcbwyjr/property-manage/electricity-bill-export\', title:\'添加收费标准\',width:500,height:400,data:{addFlag:1}, mask:true}"><i class="fa fa-plus"></i> 导出</button>';
        return html;
    }
</script>